package base;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeClass;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

public class BaseDriver {
	String urlString = "http://127.0.0.1:4723/wd/hub";
	public AndroidDriver<AndroidElement> driver = null;
//com.cnezsoft.xxm/.MainActivity
	@BeforeClass
	public void initDriver() throws MalformedURLException {
		DesiredCapabilities capabilities = new DesiredCapabilities();
//		File app = new File("./apps/xuanxuan.android.5.4.apk");
//		System.out.println(app.getAbsolutePath());
		capabilities.setCapability("deviceName", "127.0.0.1:62001");
		capabilities.setCapability("platformName", "Android");
		capabilities.setCapability("appPackage", "com.cnezsoft.xxm");
		capabilities.setCapability("appActivity", ".MainActivity");
		URL url = new URL(urlString);
		driver = new AndroidDriver<AndroidElement>(url, capabilities);
	}

}
